package cn.com.dhcc.turbo.entity.sysmgr;

import java.util.Date;
import java.util.List;

import cn.com.dhcc.app.core.annotation.SiColumn;
import cn.com.dhcc.app.core.annotation.SiNotDbColumn;
import cn.com.dhcc.app.core.annotation.SiTable;
import cn.com.dhcc.app.core.base.ModuleFeatureBean;
import cn.com.dhcc.app.core.entity.account.Role;
import cn.com.dhcc.app.core.entity.account.User;
import cn.com.dhcc.app.core.tag.CommonStaticCode.YESNO;

/**
 * 登录用户
 * 
 * @author qiao
 * @2014-6-17 @上午9:47:40
 */
@SiTable(name = "TURBO_USER")
public class UserInfo extends ModuleFeatureBean implements User {
	@SiColumn(isId = true)
	private String id;// ID N CHAR(32) Y id
	@SiColumn(name = "USER_NAME")
	private String userName;// USER_NAME N VARCHAR2(200) Y 用户名
	private String pwd;// PWD N VARCHAR2(200) Y 密码
	@SiColumn(name = "OWN_ID")
	private String ownId;// OWN_ID N CHAR(32) Y 所属所属适配器或者节点id
	private String email;// EMAIL N VARCHAR2(200) Y 邮箱
	private String tel;// TEL N VARCHAR2(200) Y 手机号码
	@SiColumn(name = "USER_TYPE")
	private String userType;// 0 业务系统管理员 1 超级管理员 2 节点管理员
	private Date mtime;// MTIME N DATE Y
	private String remark;// REMARK N VARCHAR2(500) Y N Y
	@SiNotDbColumn
	private String userNameStr;
	@SiNotDbColumn
	private String nodeName;

	@SiNotDbColumn
	private String slAuthFlag;//根据节点和用户的权限信息
	public static enum SL_AUTH_FLAG{
		MWR_NODE_ADMIN_USER("1","中央节点管理用户"),
		NOT_MWR_MGR_NODE_ADMIN_USER("2","非中央管理节点管理用户"),
		NOT_MGR_NODE_ADMIN_USER("3","非管理节点管理用户"),
		SYS_USER("4","适配器用户");
		private String code;
		private String name;

		private SL_AUTH_FLAG(String code, String name) {
			this.code = code;
			this.name = name;
		}

		public String getName() {
			return name;
		}

		public String getCode() {
			return code;
		}
	}
	public static enum USER_TYPE {
		SYSUSER("0", "业务系统用户"), ADMINUSER("1", "超级管理员"), NODEUSER("2", "节点用户");
		private String code;
		private String name;

		private USER_TYPE(String code, String name) {
			this.code = code;
			this.name = name;
		}

		public String getName() {
			return name;
		}

		public String getCode() {
			return code;
		}
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPwd() {
		return pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public String getOwnId() {
		return ownId;
	}

	public void setOwnId(String ownId) {
		this.ownId = ownId;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getUserType() {
		return userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

	public Date getMtime() {
		return mtime;
	}

	public void setMtime(Date mtime) {
		this.mtime = mtime;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public boolean isNodeUser() {
		return YESNO.YES.getStatus().equalsIgnoreCase(userType);
	}

	public String getUserNameStr() {
		return userNameStr;
	}

	public void setUserNameStr(String userNameStr) {
		this.userNameStr = userNameStr;
	}

	public String getNodeName() {
		return nodeName;
	}

	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}


	
	public String getSlAuthFlag() {
		return slAuthFlag;
	}

	public void setSlAuthFlag(String slAuthFlag) {
		this.slAuthFlag = slAuthFlag;
	}

	@Override
	public String toString() {
		return "UserInfo [id=" + id + ", userName=" + userName + ", pwd=" + pwd + ", ownId=" + ownId + ", email="
				+ email + ", tel=" + tel + ", nodeAdmin=" + userType + ", mtime=" + mtime + ", remark=" + remark
				+ ", userNameStr=" + userNameStr + ", nodeName=" + nodeName + "]";
	}

	@Override
	public List<Role> getRoleList() {
		return null;
	}

}
